package com.example.tkmapper.tool;

import com.example.tkmapper.dao.ActivityTodayDataMapper;
import com.example.tkmapper.entity.ActivityTodayData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author huxiao
 * @description ReadFile
 * @date 2022/4/8 11:18 上午
 */
@Component
public class ReadFile {

    public List<String> readFile(String path) throws IOException {
        List<String> list = new ArrayList<>();
        FileInputStream fis = new FileInputStream(path);
        InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
        BufferedReader br = new BufferedReader(isr);
        String line;
        while ((line = br.readLine()) != null) {
            list.add(line);
        }
        br.close();
        isr.close();
        fis.close();
        return  list;
    }
}
